Many optical inspection tools utilize interferometric techniques to characterize the surface profile of a sample. A typical interferometer in a wafer inspection system coherently combines light reflected from a wafer surface with light reflected from a reference flat to generate an interferogram containing interference fringes associated with constructive and destructive interference of the light. The intensity of the interferogram is a sinusoidal modulation of the surface height, assuming top surface reflection. Specifically, a variation of surface height equal to one-half the wavelength of the light corresponds to one period of intensity modulation on the interferogram. Phase unwrapping algorithms generate a height map of the wafer from the modulated interferogram. However, the application of interferometric techniques to the characterization of patterned wafers presents unique challenges due to variations on the wafer surface including discontinuous jumps in the surface profile and the presence of thin films. Therefore, it is desirable to provide a method and system that cures the defects identified above in previous approaches.